OBJ = loader.o kernel.o system.o string.o vga.o
GCC-OPTS = -I./include -Wall -Wextra -Werror -nostdlib -nostartfiles -nodefaultlibs -fno-builtin

kernel:	loader.s kernel.c
	nasm -f elf -o loader.o loader.s
	i686-elf-gcc -o kernel.o -c kernel.c $(GCC-OPTS)
	i686-elf-gcc -o system.o -c system.c $(GCC-OPTS)
	i686-elf-gcc -o string.o -c string.c $(GCC-OPTS)
	i686-elf-gcc -o vga.o -c vga.c $(GCC-OPTS)
	i686-elf-ld -T linker.ld -o kernel.bin $(OBJ)

image: kernel
	dd if=/dev/zero of=pad bs=1 count=750
	cat stage1 stage2 pad kernel.bin > lsecos.img

clean: image
	rm *.o
	rm pad

all: kernel image clean
